#pragma once

#include "SpriteBatch.h"
#include <VG/openvg.h>

class OVGSpriteBatch : public SpriteBatch
{
public:
    OVGSpriteBatch( int targetWidth, int targetHeight );
    ~OVGSpriteBatch();

    void begin( BlendMode bmode = eALPHA, TransformMode dTransform = ePIXELSPACE, float *customProjectionMatrix = 0);
    void end();
    void draw ( SpriteDrawInfo *sdi, int spriteCount=1 );
    void flushSprites() {}

 protected:
        // Set source rectangle / image / etc.. returns a handle to a texture to be drawn.
        // Fills the actual widht and height of the handle returned for transform to use.
    VGuint setSource( SpriteDrawInfo *sdi, int &widthTarget, int &heightTarget );

    VGPaint paint;
    VGuint lastTextureHandle;
    VGuint lastTextureWidth;
    VGuint lastTextureHeight;

    VGImage subImage;
    VGuint subImageSource;
    int subx, suby, subWidth, subHeight;

    float customProjectionMatrix[16];

    TransformMode tmode;
};
